<!doctype html>
<html class="theme-next   use-motion ">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />












  <link href="/vendors/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css"/>




  <link href="//fonts.googleapis.com/css?family=Lato:300,400,700,400italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">



<link href="/vendors/font-awesome/css/font-awesome.min.css?v=4.4.0" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=0.4.5.2" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="java,note," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=0.4.5.2" />






<meta name="description" content="Programming Conceptions独立的地址空间使得进程共享状态信息变得更加困难。为了共享信息，他们必须使用显式的ＩＰＣ(interprocess communication, IPC)机制。基于进程设计的另一个缺点是，他们往往比较慢，因为进程控制和IPC的开销都很高．
一个线程(thread)就是运行在一个进程上下文中的逻辑流．线程由内核调度．每个线程都有它自己的线程上下文(thre">
<meta property="og:type" content="article">
<meta property="og:title" content="Conceptions of Java">
<meta property="og:url" content="https://lechance.github.io/posts/2015/02/13/notes-programming-conceptions/index.html">
<meta property="og:site_name" content="Lechance's Blog">
<meta property="og:description" content="Programming Conceptions独立的地址空间使得进程共享状态信息变得更加困难。为了共享信息，他们必须使用显式的ＩＰＣ(interprocess communication, IPC)机制。基于进程设计的另一个缺点是，他们往往比较慢，因为进程控制和IPC的开销都很高．
一个线程(thread)就是运行在一个进程上下文中的逻辑流．线程由内核调度．每个线程都有它自己的线程上下文(thre">
<meta property="og:updated_time" content="2016-08-04T07:17:41.163Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Conceptions of Java">
<meta name="twitter:description" content="Programming Conceptions独立的地址空间使得进程共享状态信息变得更加困难。为了共享信息，他们必须使用显式的ＩＰＣ(interprocess communication, IPC)机制。基于进程设计的另一个缺点是，他们往往比较慢，因为进程控制和IPC的开销都很高．
一个线程(thread)就是运行在一个进程上下文中的逻辑流．线程由内核调度．每个线程都有它自己的线程上下文(thre">



<script type="text/javascript" id="hexo.configuration">
  var CONFIG = {
    scheme: '',
    sidebar: 'hide',
    motion: true
  };
</script>

  <title> Conceptions of Java | Lechance's Blog </title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="en">

  <!--[if lte IE 8]>
  <div style=' clear: both; height: 59px; padding:0 0 0 15px; position: relative;margin:0 auto;'>
    <a href="http://windows.microsoft.com/en-US/internet-explorer/products/ie/home?ocid=ie6_countdown_bannercode">
      <img src="http://7u2nvr.com1.z0.glb.clouddn.com/picouterie.jpg" border="0" height="42" width="820"
           alt="You are using an outdated browser. For a faster, safer browsing experience, upgrade for free today or use other browser ,like chrome firefox safari."
           style='margin-left:auto;margin-right:auto;display: block;'/>
    </a>
  </div>
<![endif]-->
  


<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
  ga('create', 'UA-75174040-1', 'auto');
  ga('send', 'pageview');
</script>


  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "//hm.baidu.com/hm.js?5641a55459d47b98c90f424b8ca53a5a";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>




  <div class="container one-column page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-meta ">
  

  <div class="custom-logo-site-title">
    <a href="/"  class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <span class="site-title">Lechance's Blog</span>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>
  <p class="site-subtitle"></p>
</div>

<div class="site-nav-toggle">
  <button>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
  </button>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu ">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-home fa-fw"></i> <br />
            
            Home
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-archive fa-fw"></i> <br />
            
            Archives
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-tags fa-fw"></i> <br />
            
            Tags
          </a>
        </li>
      
        
        <li class="menu-item menu-item-links">
          <a href="/links" rel="section">
            
              <i class="menu-item-icon fa fa-link fa-fw"></i> <br />
            
            Links
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about" rel="section">
            
              <i class="menu-item-icon fa fa-user fa-fw"></i> <br />
            
            About
          </a>
        </li>
      
        
        <li class="menu-item menu-item-rss">
          <a href="/atom.xml" rel="section">
            
              <i class="menu-item-icon fa fa-rss fa-fw"></i> <br />
            
            Rss
          </a>
        </li>
      

      
      
    </ul>
  

  
</nav>

 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div id="content" class="content">
          

  <div id="posts" class="posts-expand">
    

  
  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                Conceptions of Java
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            Posted on
            <time itemprop="dateCreated" datetime="2015-02-13T20:39:13+08:00" content="2015-02-13">
              2015-02-13
            </time>
          </span>

          
            <span class="post-category" >
              &nbsp; | &nbsp; In
              
                <span itemprop="about" itemscope itemtype="https://schema.org/Thing">
                  <a href="/categories/Java/" itemprop="url" rel="index">
                    <span itemprop="name">Java</span>
                  </a>
                </span>

                
                

              
            </span>
          

          
            
              <span class="post-comments-count">
                &nbsp; | &nbsp;
                <a href="/posts/2015/02/13/notes-programming-conceptions/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count ds-thread-count" data-thread-key="posts/2015/02/13/notes-programming-conceptions/" itemprop="commentsCount"></span>
                </a>
              </span>
            
          

          
		  
		  
			 &nbsp; | &nbsp;
			 <span id="/posts/2015/02/13/notes-programming-conceptions/"class="leancloud_visitors"  data-flag-title="Conceptions of Java">
             &nbsp;Views
            </span>
		  
		
        </div>
      </header>
    


    <div class="post-body">

      
      

      
        <span itemprop="articleBody"><h4 id="Programming_Conceptions">Programming Conceptions</h4><p>独立的地址空间使得进程共享状态信息变得更加困难。为了共享信息，他们必须使用显式的ＩＰＣ(interprocess communication, IPC)机制。基于进程设计的另一个缺点是，他们往往比较慢，因为进程控制和IPC的开销都很高．</p>
<p>一个线程(thread)就是运行在一个进程上下文中的逻辑流．线程由内核调度．每个线程都有它自己的线程上下文(thread context)，包含一个唯一的整数线程ID(Thread ID,TID),栈，栈指针，程序计数器,通用目的寄存器和条件码．所有运行在一个进程里的线程共享该进程的虚拟地址空间．<br>基于线程的逻辑流结合了基于进程和基于I/O多路复用的流的特性．</p>
<p>thread routine 线程例程</p>
<p>分离线程：在任何一个时间点上，线程是可结合的（joinable）或者是可以分离的（detached）的．一个可结合的线程能够被其他线程收回和杀死．在被其他线程收回之前，它的存储资源（例如栈）是不释放的．相反，一个分离的线程是不能被其他线程回收和杀死的．他的存储器资源在它终止时由系统自动释放．<br>默认情况下，线程是被创建成可结合的．为了避免存储器泄露，每个线程都应该要么被其他线程显式地收回，要么通过调用pthread_detached函数被分离．</p>
<h4 id="Operator_in_Java">Operator in Java</h4><h5 id="Arithmetic_Operators">Arithmetic Operators</h5><p>Mathematical (or arithmetic) operators are used in performing mathematical operations in an arithmetic expression. The various arithmetic operators are listed in Table SR2-1.</p>
<figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">Operator							Symbol</span><br><span class="line"></span><br><span class="line">Addition					  		+</span><br><span class="line">Increment					  		++</span><br><span class="line">Division					  		/</span><br><span class="line">Unary Negation					  		~</span><br><span class="line">Unary Minus							-</span><br><span class="line">Multiplication					  		*</span><br><span class="line">Logical NOT							!</span><br><span class="line">Unary  Plus							+</span><br><span class="line">Subtraction							-</span><br><span class="line">Decrement						  	--</span><br><span class="line">Remainder					  		%</span><br><span class="line">Typecasting					  		(<span class="built_in">type</span>)</span><br></pre></td></tr></table></figure>
<p>TABLE SR2-1.   Arithmetic Operators</p>
<h5 id="Unary_Operators">Unary Operators</h5><p>As the name indicates, unary operators operate on a single operand. We discuss the four unary<br>operators in this section. You have already seen the use of the unary minus <code>(-)</code> operator in the<br>previous example. The unary minus operator negates the operand. Likewise, a unary plus <code>(+)</code><br>operator is available in Java.<br>Tip:The unary plus operator is included for symmetry only and has no<br>effect on the sign of its operand.<br>The increment (++) and decrement (–) operators increment or decrement the value of their<br>operand by 1. These are also called “auto” operators because they operate and assign the result<br>automatically. The implicit operand for both the operators is 1, which means that the given<br>operand value is either increased or decreased by exactly 1, depending on the operation.</p>
<h5 id="Post_and_Pre_Operators">Post and Pre Operators</h5><p>The two “auto” operators can be applied to a variable as a suffix or a prefix. Depending on which<br>side of the variable they are applied, they produce different results.</p>
<p>String Concatenation<br>In Java, the + operator, when applied to a string data type, performs concatenation of strings.<br>Tip<br>In other languages, the use of the + operator for string concatenation<br>is considered a feature of operator overloading. Java does not support<br>operator overloading in the sense that a developer cannot redefine<br>the meaning of any of the operators. The string concatenation is<br>equivalent to operator overloading defined internally in Java.</p>
<h5 id="Type_Conversions">Type Conversions</h5><p>Oftentimes, in a program statement, you assign the value of one data type to another. For example,<br>you may assign an integer variable to a float type, or vice versa. When you assign an integer to a<br>float type, there is no loss of magnitude.</p>
<p><em>Caution:</em></p>
<blockquote>
<p>Converting int to float may result in loss of precision.</p>
</blockquote>
<h5 id="Bitwise_Operators">Bitwise Operators</h5><p>Bitwise operators are used to test, set, or shift actual bits in a byte or a word that corresponds to<br>the char and int data types. These operators cannot perform operations on data types such as<br>float, double, and boolean. Table SR2-4 lists the various bitwise operators.</p>
<figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br></pre></td><td class="code"><pre><span class="line">				Operator					   Meaning</span><br><span class="line"></span><br><span class="line">				&amp;					  		AND</span><br><span class="line">				&gt;&gt;					  		Right-shift</span><br><span class="line">				~					  		NOT</span><br><span class="line">				&lt;&lt;					  		Left-shift</span><br><span class="line">				^					  		XOR</span><br><span class="line">				|					  		OR</span><br><span class="line">				&gt;&gt;&gt;					  		Right-shift with zero fill</span><br><span class="line">``` </span><br><span class="line"></span><br><span class="line">TABLE SR2-<span class="number">4</span>.	  Bitwise Operators</span><br><span class="line"></span><br><span class="line">These operators perform the well-known Boolean operations, as their names suggest.</span><br><span class="line"></span><br><span class="line"><span class="comment">##### Logical Conditional Operators</span></span><br><span class="line"></span><br><span class="line">As mentioned earlier, logical operators can take one, two, or three operands. The lists of operators</span><br><span class="line">that fall <span class="keyword">in</span> this category are given <span class="keyword">in</span> Table SR2-<span class="number">5</span>. The first two operators operate on two operands,</span><br><span class="line">the NOT operator operates on a single operand, and the ternary conditional operator takes three</span><br><span class="line">operands.</span><br><span class="line"></span><br><span class="line">``` sh</span><br><span class="line">Operator						 Meaning</span><br><span class="line">&amp;&amp;					  		AND</span><br><span class="line">!					  		NOT</span><br><span class="line">||					  		OR</span><br><span class="line">?:					  		ternary condition</span><br><span class="line">``` </span><br><span class="line"></span><br><span class="line">TABLE SR2-<span class="number">5</span>.    Logical Operators</span><br><span class="line"></span><br><span class="line"><span class="comment">##### Relational Operators</span></span><br><span class="line">Relational operators and used to compare two values.The output of the comparison is always a</span><br><span class="line">Boolean value, <span class="built_in">which</span> is <span class="literal">true</span> or false. The various relational operators are listed <span class="keyword">in</span> Table SR2-<span class="number">6</span>.</span><br><span class="line">These operators generally operate on numeric and character data types.</span><br><span class="line"></span><br><span class="line">``` sh</span><br><span class="line"></span><br><span class="line">Operation                Operator</span><br><span class="line"></span><br><span class="line">Greater than                &gt;</span><br><span class="line">Not equal to                !=</span><br><span class="line">Less than or equal to       &lt;=</span><br><span class="line">Greater than or equal to    &gt;=</span><br><span class="line">Less than                   &lt;</span><br><span class="line">Equal to                    ==</span><br><span class="line">			instanceof</span><br><span class="line">``` </span><br><span class="line"></span><br><span class="line">TABLE SR2-<span class="number">6</span>.   Relational Operators</span><br><span class="line"></span><br><span class="line"><span class="comment">##### Assignment Operators</span></span><br><span class="line"></span><br><span class="line">The basic assignment operator is the equal to (=)operator,<span class="built_in">where</span> the right-side value of the expression is assigned to the variable defined on the left-side of the expression.</span><br><span class="line">The various assignment operators are listed <span class="keyword">in</span> Table SR2-<span class="number">7</span>.</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">``` sh</span><br><span class="line">Operation	(操作)					 Operator(操作符)</span><br><span class="line">Assignment					          =</span><br><span class="line">Add and assign					          +=</span><br><span class="line">Subtract and assign					  -=</span><br><span class="line">Multiply and assign					  *=</span><br><span class="line">Divide and assign					  /=</span><br><span class="line">Modulo divide and assign				  %=</span><br><span class="line">Left <span class="built_in">shift</span> and assign					  &lt;&lt;=</span><br><span class="line">Right <span class="built_in">shift</span> and assign					  &gt;&gt;=</span><br><span class="line">Unsigned right <span class="built_in">shift</span> and assign				  &gt;&gt;&gt;=</span><br><span class="line">Bitwise logical AND and assign				  &amp;=</span><br><span class="line">Bitwise OR and assign					  |=</span><br><span class="line">Bitwise exclusive OR and assign			          ^=</span><br><span class="line">``` </span><br><span class="line"></span><br><span class="line">TABLE SR2-<span class="number">7</span>.            Assignment Operators</span><br><span class="line"></span><br><span class="line"><span class="comment">##### Separators</span></span><br><span class="line"></span><br><span class="line">The following nine ASCII characters are the separators (punctuators) <span class="keyword">in</span> Java:</span><br></pre></td></tr></table></figure>
<p>Separator : one of<br>( )  {  }  [  ]   ;   ,   .<br>```<br>They carry special meaning when used in program statements.For example, the parentheses are used in a function call and typecasting. The curly braces are used for compounding statements. The square brackets are used in array declarations. The semicolon is used in terminating a program statement; a comma is used in separating multiple statements and declarations. Finally, a dot is used in defining the package hierarchy or calling object methods. You will learn the use of these separators in the book as we delve deeper into the language syntax.</p>
</span>
      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/java/" rel="tag">#java</a>
          
            <a href="/tags/note/" rel="tag">#note</a>
          
        </div>
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
          </div>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/posts/2015/05/01/java-reflection-tutorial/" rel="prev" title="Java Reflection Tutorial">
                Java Reflection Tutorial <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
        <div class="ds-share flat" data-thread-key="posts/2015/02/13/notes-programming-conceptions/"
     data-title="Conceptions of Java"
     data-content=""
     data-url="https://lechance.github.io/posts/2015/02/13/notes-programming-conceptions/">
  <div class="ds-share-inline">
    <ul  class="ds-share-icons-16">

      <li data-toggle="ds-share-icons-more"><a class="ds-more" href="javascript:void(0);">分享到：</a></li>
      <li><a class="ds-weibo" href="javascript:void(0);" data-service="weibo">微博</a></li>
      <li><a class="ds-qzone" href="javascript:void(0);" data-service="qzone">QQ空间</a></li>
      <li><a class="ds-qqt" href="javascript:void(0);" data-service="qqt">腾讯微博</a></li>
      <li><a class="ds-wechat" href="javascript:void(0);" data-service="wechat">微信</a></li>

    </ul>
    <div class="ds-share-icons-more">
    </div>
  </div>
</div>
      
    </div>
  </div>


        </div>

        


        
  <div class="comments" id="comments">
    
      <div class="ds-thread" data-thread-key="posts/2015/02/13/notes-programming-conceptions/"
           data-title="Conceptions of Java" data-url="https://lechance.github.io/posts/2015/02/13/notes-programming-conceptions/">
      </div>
    
  </div>


      </div>

      
        
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            Table Of Contents
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            Overview
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel ">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" src="/upload/image/avatar.png" alt="Lechance Cheung" itemprop="image"/>
          <p class="site-author-name" itemprop="name">Lechance Cheung</p>
        </div>
        <p class="site-description motion-element" itemprop="description">The code to change the world</p>
        <nav class="site-state motion-element">
          <div class="site-state-item site-state-posts">
            <a href="/archives">
              <span class="site-state-item-count">43</span>
              <span class="site-state-item-name">posts</span>
            </a>
          </div>

          <div class="site-state-item site-state-categories">
            
              <span class="site-state-item-count">15</span>
              <span class="site-state-item-name">categories</span>
              
          </div>

          <div class="site-state-item site-state-tags">
            <a href="/tags">
              <span class="site-state-item-count">66</span>
              <span class="site-state-item-name">tags</span>
              </a>
          </div>

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="http://weibo.com/lechance" target="_blank">
                  
                    <i class="fa fa-weibo"></i> Weibo
                  
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="https://github.com/lechance" target="_blank">
                  
                    <i class="fa fa-globe"></i> Github
                  
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="https://guides.github.com/features/mastering-markdown/" target="_blank">
                  
                    <i class="fa fa-globe"></i> MD CheatSheet
                  
                </a>
              </span>
            
          
        </div>

        
        
          <div class="cc-license motion-element" itemprop="license">
            <a href="http://creativecommons.org/licenses/by-nc-sa/4.0" class="cc-opacity" target="_blank">
              <img src="/images/cc-by-nc-sa.svg" alt="Creative Commons" />
            </a>
          </div>
        

        <div class="links-of-author motion-element">
          
            <p class="site-author-name">Common Sites</p>
            
              <span class="links-of-author-item">
                <a href="https://developers.google.cn" target="_blank">Google Developers</a>
              </span>
            
              <span class="links-of-author-item">
                <a href="http://androidweekly.net/archive" target="_blank">Android Weekly</a>
              </span>
            
              <span class="links-of-author-item">
                <a href="https://rxjava.yuxingxin.com" target="_blank">RxJava Essentials</a>
              </span>
            
              <span class="links-of-author-item">
                <a href="https://hc.apache.org/index.html" target="_blank">Http Components</a>
              </span>
            
              <span class="links-of-author-item">
                <a href="http://simpledeveloper.com" target="_blank">Simple Developer</a>
              </span>
            
              <span class="links-of-author-item">
                <a href="https://www.ibm.com/developerworks/library" target="_blank">IBM(Technical Library)</a>
              </span>
            
          
        </div>

      </section>

      
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc-indicator-top post-toc-indicator">
            <i class="fa fa-angle-double-up"></i>
          </div>
          <div class="post-toc">
            
              
            
            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-4"><a class="nav-link" href="#Programming_Conceptions"><span class="nav-number">1.</span> <span class="nav-text">Programming Conceptions</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#Operator_in_Java"><span class="nav-number">2.</span> <span class="nav-text">Operator in Java</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#Arithmetic_Operators"><span class="nav-number">2.1.</span> <span class="nav-text">Arithmetic Operators</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#Unary_Operators"><span class="nav-number">2.2.</span> <span class="nav-text">Unary Operators</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#Post_and_Pre_Operators"><span class="nav-number">2.3.</span> <span class="nav-text">Post and Pre Operators</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#Type_Conversions"><span class="nav-number">2.4.</span> <span class="nav-text">Type Conversions</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#Bitwise_Operators"><span class="nav-number">2.5.</span> <span class="nav-text">Bitwise Operators</span></a></li></ol></li></ol></div>
            
          </div>
          <div class="post-toc-indicator-bottom post-toc-indicator">
            <i class="fa fa-angle-double-down"></i>
          </div>
        </section>
      

    </div>
  </aside>


      
    </main>

    <footer id="footer" class="footer">
      <div class="google-ad">
	  <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- myblogfootergooglead -->
<ins class="adsbygoogle"
     style="display:inline-block;width:468px;height:60px"
     data-ad-client="ca-pub-6226577131784709"
     data-ad-slot="6824128270"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

      </div>
      <div class="footer-inner">
        <script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js">
</script>

<div class="copyright" >
  
  &copy;  2015 - 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="icon-next-heart fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Lechance Cheung</span>
</div>

<div class="powered-by">
  Powered by <a class="theme-link" href="http://hexo.io">Hexo</a>
</div>

<div class="theme-info">
  Theme -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT
  </a>
</div>

<span id="busuanzi_container_site_pv">
  &nbsp; | &nbsp;PV <span id="busuanzi_value_site_pv"></span> &nbsp;| &nbsp;UV <span id="busuanzi_value_site_uv"></span>
</span>



      </div>
    </footer>

    <div class="back-to-top"></div>
  </div>

  <script type="text/javascript" src="/vendors/jquery/index.js?v=2.1.3"></script>

  
  

  
    

  
    
  

  <script type="text/javascript">
    var duoshuoQuery = {short_name:"lechance"};
    (function() {
      var ds = document.createElement('script');
      ds.type = 'text/javascript';ds.async = true;
      ds.id = 'duoshuo-script';
      ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//lechance.github.io/embed_ua.js';
      ds.charset = 'UTF-8';
      (document.getElementsByTagName('head')[0]
      || document.getElementsByTagName('body')[0]).appendChild(ds);
    })();
  </script>
    
     


    
  

  
  <script type="text/javascript" src="/vendors/fancybox/source/jquery.fancybox.pack.js"></script>
  <script type="text/javascript" src="/js/fancy-box.js?v=0.4.5.2"></script>


  <script type="text/javascript" src="/js/helpers.js?v=0.4.5.2"></script>
  <script type="text/javascript" src="/vendors/velocity/velocity.min.js"></script>
<script type="text/javascript" src="/vendors/velocity/velocity.ui.min.js"></script>

<script type="text/javascript" src="/js/motion.js?v=0.4.5.2" id="motion.global"></script>


  <script type="text/javascript" src="/vendors/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  <script type="text/javascript" src="/vendors/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  
<script type="text/javascript" src="/js/bootstrap.scrollspy.js?v=0.4.5.2" id="bootstrap.scrollspy.custom"></script>


<script type="text/javascript" id="sidebar.toc.highlight">
  $(document).ready(function () {
    var tocSelector = '.post-toc';
    var $tocSelector = $(tocSelector);
    var activeCurrentSelector = '.active-current';

    $tocSelector
      .on('activate.bs.scrollspy', function () {
        var $currentActiveElement = $(tocSelector + ' .active').last();

        removeCurrentActiveClass();
        $currentActiveElement.addClass('active-current');

        $tocSelector[0].scrollTop = $currentActiveElement.position().top;
      })
      .on('clear.bs.scrollspy', function () {
        removeCurrentActiveClass();
      });

    function removeCurrentActiveClass () {
      $(tocSelector + ' ' + activeCurrentSelector)
        .removeClass(activeCurrentSelector.substring(1));
    }

    function processTOC () {
      getTOCMaxHeight();
      toggleTOCOverflowIndicators();
    }

    function getTOCMaxHeight () {
      var height = $('.sidebar').height() -
                   $tocSelector.position().top -
                   $('.post-toc-indicator-bottom').height();

      $tocSelector.css('height', height);

      return height;
    }

    function toggleTOCOverflowIndicators () {
      tocOverflowIndicator(
        '.post-toc-indicator-top',
        $tocSelector.scrollTop() > 0 ? 'show' : 'hide'
      );

      tocOverflowIndicator(
        '.post-toc-indicator-bottom',
        $tocSelector.scrollTop() >= $tocSelector.find('ol').height() - $tocSelector.height() ? 'hide' : 'show'
      )
    }

    $(document).on('sidebar.motion.complete', function () {
      processTOC();
    });

    $('body').scrollspy({ target: tocSelector });
    $(window).on('resize', function () {
      if ( $('.sidebar').hasClass('sidebar-active') ) {
        processTOC();
      }
    });

    onScroll($tocSelector);

    function onScroll (element) {
      element.on('mousewheel DOMMouseScroll', function (event) {
          var oe = event.originalEvent;
          var delta = oe.wheelDelta || -oe.detail;

          this.scrollTop += ( delta < 0 ? 1 : -1 ) * 30;
          event.preventDefault();

          toggleTOCOverflowIndicators();
      });
    }

    function tocOverflowIndicator (indicator, action) {
      var $indicator = $(indicator);
      var opacity = action === 'show' ? 1 : 0;
      $indicator.velocity ?
        $indicator.velocity('stop').velocity({
          opacity: opacity
        }, { duration: 100 }) :
        $indicator.stop().animate({
          opacity: opacity
        }, 100);
    }

  });
</script>

<script type="text/javascript" id="sidebar.nav">
  $(document).ready(function () {
    var html = $('html');
    var TAB_ANIMATE_DURATION = 200;
    var hasVelocity = $.isFunction(html.velocity);

    $('.sidebar-nav li').on('click', function () {
      var item = $(this);
      var activeTabClassName = 'sidebar-nav-active';
      var activePanelClassName = 'sidebar-panel-active';
      if (item.hasClass(activeTabClassName)) {
        return;
      }

      var currentTarget = $('.' + activePanelClassName);
      var target = $('.' + item.data('target'));

      hasVelocity ?
        currentTarget.velocity('transition.slideUpOut', TAB_ANIMATE_DURATION, function () {
          target
            .velocity('stop')
            .velocity('transition.slideDownIn', TAB_ANIMATE_DURATION)
            .addClass(activePanelClassName);
        }) :
        currentTarget.animate({ opacity: 0 }, TAB_ANIMATE_DURATION, function () {
          currentTarget.hide();
          target
            .stop()
            .css({'opacity': 0, 'display': 'block'})
            .animate({ opacity: 1 }, TAB_ANIMATE_DURATION, function () {
              currentTarget.removeClass(activePanelClassName);
              target.addClass(activePanelClassName);
            });
        });

      item.siblings().removeClass(activeTabClassName);
      item.addClass(activeTabClassName);
    });

    $('.post-toc a').on('click', function (e) {
      e.preventDefault();
      var targetSelector = escapeSelector(this.getAttribute('href'));
      var offset = $(targetSelector).offset().top;
      hasVelocity ?
        html.velocity('stop').velocity('scroll', {
          offset: offset  + 'px',
          mobileHA: false
        }) :
        $('html, body').stop().animate({
          scrollTop: offset
        }, 500);
    });

    // Expand sidebar on post detail page by default, when post has a toc.
    motionMiddleWares.sidebar = function () {
      var $tocContent = $('.post-toc-content');
      if (CONFIG.sidebar === 'post') {
        if ($tocContent.length > 0 && $tocContent.html().trim().length > 0) {
          displaySidebar();
        }
      }
    };
  });
</script>



  <script type="text/javascript" src="/js/bootstrap.js"></script>

  
  

  
  
  
  
  	 <!-- custom analytics part create by xiamo -->
<script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.1.js"></script>
<script>AV.initialize("cHqcCBDQtcbkltuUTyplEYWJ-gzGzoHsz", "SkioJGixXR48ACpgA0W2lOWd");</script>
<script>
function showTime(Counter) {
	var query = new AV.Query(Counter);
	$(".leancloud_visitors").each(function() {
		var url = $(this).attr("id").trim();
		query.equalTo("url", url);
		query.find({
			success: function(results) {
				if (results.length == 0) {
					var content = '0 ' + $(document.getElementById(url)).text();
					$(document.getElementById(url)).text(content);
					return;
				}
				for (var i = 0; i < results.length; i++) {
					var object = results[i];
					var content = object.get('time') + ' ' + $(document.getElementById(url)).text();
					$(document.getElementById(url)).text(content);
				}
			},
			error: function(object, error) {
				console.log("Error: " + error.code + " " + error.message);
			}
		});

	});
}

function addCount(Counter) {
	var Counter = AV.Object.extend("Counter");
	url = $(".leancloud_visitors").attr('id').trim();
	title = $(".leancloud_visitors").attr('data-flag-title').trim();
	var query = new AV.Query(Counter);
	query.equalTo("url", url);
	query.find({
		success: function(results) {
			if (results.length > 0) {
				var counter = results[0];
				counter.fetchWhenSave(true);
				counter.increment("time");
				counter.save(null, {
					success: function(counter) {
						var content =  counter.get('time') + ' ' + $(document.getElementById(url)).text();
						$(document.getElementById(url)).text(content);
					},
					error: function(counter, error) {
						console.log('Failed to save Visitor num, with error message: ' + error.message);
					}
				});
			} else {
				var newcounter = new Counter();
				newcounter.set("title", title);
				newcounter.set("url", url);
				newcounter.set("time", 1);
				newcounter.save(null, {
					success: function(newcounter) {
					    console.log("newcounter.get('time')="+newcounter.get('time'));
						var content = newcounter.get('time') + ' ' + $(document.getElementById(url)).text();
						$(document.getElementById(url)).text(content);
					},
					error: function(newcounter, error) {
						console.log('Failed to create');
					}
				});
			}
		},
		error: function(error) {
			console.log('Error:' + error.code + " " + error.message);
		}
	});
}
$(function() {
	var Counter = AV.Object.extend("Counter");
	if ($('.leancloud_visitors').length == 1) {
		addCount(Counter);
	} else if ($('.post-title-link').length > 1) {
		showTime(Counter);
	}
}); 
</script>
  
  
<!-- mathjax config similar to math.stackexchange -->

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    tex2jax: {
      inlineMath: [ ['$','$'], ["\\(","\\)"] ],
      processEscapes: true
    }
  });
</script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Config({
      tex2jax: {
        skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
      }
    });
</script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for(i=0; i < all.length; i += 1) {
            all[i].SourceElement().parentNode.className += ' has-jax';
        }
    });
</script>

<script type="text/javascript" src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
</body>
</html>
